<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-04 15:22:10
 * @LastEditTime: 2023-07-25 16:02:13
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Models;



class Role extends BaseModel
    {
    public $table = "basedata_role";
    protected $guarded = [];

    public function menu()
        {
        return $this->hasManyThrough(Menu::class, RoleMenu::class, "role_id", 'id', 'id', 'menu_id');
        }
    public function table_right_btn()
        {
        return $this->hasManyThrough(Table::class, RoleTable::class, "role_id", 'id', 'id', 'table_id');
        }
    public function role_table()
        {
        return $this->hasMany(RoleTable::class, "role_id");
        }
    public function department()
        {
        return $this->hasManyThrough(Department::class, RoleDepartment::class, "role_id", 'id', 'id', 'department_id');
        }
    public function api()
        {
        return $this->hasManyThrough(Api::class, RoleApi::class, "role_id", 'id', 'id', 'api_id');
        }
    public function user()
        {
        return $this->hasManyThrough(User::class, UserRole::class, "role_id", 'id', 'id', 'user_id');
        }
    public function column()
        {
        return $this->hasManyThrough(TableColumn::class, RoleColumn::class, "role_id", 'id', 'id', 'column_id');
        }

    }